#include <REGX52.H>
#include <INTRINS.H>

sbit LED=P2^0;

void Delay(unsigned int t)
{
	while(t--);
}

void main()
{
	unsigned char Time;
	unsigned char i;
	LED = 0;
	
	while(1)
	{
		for(Time=0; Time<100; Time++){
			for(i=0; i<10; i++)		//在每个亮度保持一段时间
			{
				LED = 0;
				Delay(Time);
				LED = 1;
				Delay(100-Time);
			}

		}
		for(Time=100; Time>0; Time--){
			for(i=0; i<10; i++)		//在每个亮度保持一段时间
			{
				LED = 0;
				Delay(Time);
				LED = 1;
				Delay(100-Time);
			}

		}
	}
}
